<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('公共配送地址新增及编辑')" />
    <style type="text/css">
        .layui-input, .layui-textarea{width: 86%;}
        .layui-form-label{width:180px}
        .layui-form-select dl{margin-left:12%;min-width: 80%;}
        .layui-edge{margin-right: 7%}
    </style>
</head>
<body>
<form class="layui-form" id="form" style="padding: 16px 84px 16px 25px;">
	<input type="hidden" id="guid" name="guid"  th:value="${publicShippingAddress?.guid}">
    <div class="layui-form-item">
        <label class="layui-form-label">收货公司：</label>
        <div class="layui-input-block">
            <input type="text" name="gCName" id="gCName" th:value="${publicShippingAddress?.gCName}" autocomplete="off" placeholder="请输入" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">收货人：</label>
        <div class="layui-input-block">
            <input type="text" name="vName" id="vName" th:value="${publicShippingAddress?.vName}" autocomplete="off" placeholder="请输入" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">地址：</label>
        <div class="layui-input-block">
            <input type="text" name="vAddress" id="vAddress" th:value="${publicShippingAddress?.vAddress}" autocomplete="off" placeholder="请输入" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">电话：</label>
        <div class="layui-input-block">
            <input type="text" name="vTel" id="vTel" th:value="${publicShippingAddress?.vTel}" autocomplete="off" placeholder="请输入" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">微信号：</label>
        <div class="layui-input-block">
            <input type="text" name="vwxh" id="vwxh" th:value="${publicShippingAddress?.vwxh}" autocomplete="off" placeholder="请输入" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">QQ：</label>
        <div class="layui-input-block">
            <input type="text" name="vQQ" id="vQQ" th:value="${publicShippingAddress?.vQQ}" autocomplete="off" placeholder="请输入" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">邮箱：</label>
        <div class="layui-input-block">
            <input type="text" name="vMail" id="vMail" th:value="${publicShippingAddress?.vMail}" autocomplete="off" placeholder="请输入" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">传真：</label>
        <div class="layui-input-block">
            <input type="text" name="vFax" id="vFax" th:value="${publicShippingAddress?.vFax}" autocomplete="off" placeholder="请输入" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">启用状态：</label>
        <div class="layui-input-block">
        	<input type="radio" name="deleted" value="0" title="启用" checked>
	    	<input type="radio" name="deleted" value="1" title="停用" th:checked="${publicShippingAddress?.deleted}">
    	</div>
    </div>
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit="" lay-filter="btn_save" id="btn_save" value="保存">
    </div>
</form>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    /*<![CDATA[*/
	var prefix = ctx + "crm/customerpublicshippingaddress",
		fields = [[${fields}]];
    /*]]>*/
</script>
<script>
var $,layer,form,table;
layui.use(['table','form','layer','jquery'], function () {
    $ = layui.$,layer = layui.layer,form = layui.form,table = layui.table;
    $.each(fields,function(i,v){
    	if(v.fieldFrontRequired){//如果字段是必填字段，则加上红*并添加必填验证
    		$("#"+v.fields).parent().prev().html('<font class="f_red">*</font>'+v.fieldName+'：');
    		$("#"+v.fields).attr('lay-verify','required');
    	}
    })
});
//提交调用的方法
function submitHandler() {
	if($('#guid').val()){//通过判断guid是否存在来判断是新增还是保存
		if ($.validate.form()) {
            $.operate.save(prefix + "/editpost", {'infoItems':JSON.stringify([$.common.formToJSON('form')])});
        }
	}else{
		if ($.validate.form()) {
			$.operate.save(prefix + "/addpost", {'infoItems':JSON.stringify([$.common.formToJSON('form')])});
		}
	}
}
</script>
</body>
</html>
